#include <bits/stdc++.h>
#define ll long long
using namespace std;

const int INF = 0x3f3f3f3f;

int n, m, k, w, s, t;
vector<vector<pair<int, int>>> adj;
vector<pair<int, int>> ta; // (点，权值)
vector<vector<int>> di;   // 缩图的距离
vector<vector<int>> dists;
vector<vector<int>> memo; // 状压dp缓存

// Dijkstra
vector<int> dijkstra(int start) {
    vector<int> dis(n + 1, INF);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> pq;
    dis[start] = 0;
    pq.push({ 0, start });
    while (!pq.empty()) {
        auto [d, u] = pq.top(); pq.pop();
        if (d != dis[u]) continue;
        for (auto [v, w] : adj[u]) {
            if (dis[u] + w < dis[v]) {
                dis[v] = dis[u] + w;
                pq.push({ dis[v], v });
            }
        }
    }
    return dis;
}

// 状压记忆化搜索
int dfs(int state, int last) {
    int& res = memo[state][last];
    if (res != -1) return res;
    if (state == (1 << last)) {
        // 从起点到 last 的距离
        return res = di[k][last];
    }
    res = INF;
    int prev_state = state ^ (1 << last);
    for (int pre = 0; pre < k; pre++) {
        if (prev_state & (1 << pre)) {
            int cand = dfs(prev_state, pre) + di[pre][last];
            res = min(res, cand);
        }
    }
    return res;
}

void solve() {
    while (cin >> n >> m >> k >> s >> t >> w) {
        adj.assign(n + 1, {});
        for (int i = 0;i < m;i++) {
            int u, v, w;
            cin >> u >> v >> w;
            adj[u].push_back({ v,w });
            adj[v].push_back({ u,w });
        }
        ta.resize(k);
        for (int i = 0;i < k;i++) cin >> ta[i].first >> ta[i].second;

        dists.clear();
        dists.push_back(dijkstra(s)); // index k: start
        dists.push_back(dijkstra(t)); // index k+1: end
        for (int i = 0;i < k;i++) {
            dists.push_back(dijkstra(ta[i].first)); // index i: task i
        }

        int total_nodes = k + 2;
        di.assign(total_nodes, vector<int>(total_nodes, INF));
        for (int i = 0;i < k;i++) {
            for (int j = 0;j < k;j++) {
                di[i][j] = dists[i + 2][ta[j].first];
            }
            di[i][k] = dists[i + 2][s]; // to start
            di[i][k + 1] = dists[i + 2][t]; // to end
        }
        for (int j = 0;j < k;j++) {
            di[k][j] = dists[0][ta[j].first]; // from start to task j
            di[k + 1][j] = dists[1][ta[j].first]; // from end to task j
        }
        di[k][k + 1] = dists[0][t];
        di[k + 1][k] = dists[1][s];

        memo.assign(1 << k, vector<int>(k, -1));

        int ans = INF;
        if (w <= 0) {
            ans = di[k][k + 1];
        }

        // 遍历所有状态
        for (int state = 1; state < (1 << k); state++) {
            int total_weight = 0;
            for (int i = 0;i < k;i++) if (state & (1 << i)) total_weight += ta[i].second;

            if (total_weight >= w) {
                for (int last = 0; last < k; last++) {
                    if (state & (1 << last)) {
                        int cost = dfs(state, last) + di[last][k + 1];
                        ans = min(ans, cost);
                    }
                }
            }
        }

        if (ans >= INF) cout << -1 << "\n";
        else cout << ans << "\n";
    }
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}
